<template>
  <Table :columns="columns2"
         :data="data2"
         :showHeader="false"></Table>
</template>
<script>
import expandRow from '@/view/components/expandRow/expandRow.vue'
export default {
  props: ['row'],
  data () {
    return {
      columns2: [
        {
          type: 'expand',
          width: 20,
          render: (h, params) => {
            this.setTable(params)
          }
        },
        {
          title: '分类',
          key: 'classify'
        },
        {
          title: '昨日留币',
          key: 'yesterdayCoin'
        },
        {
          title: '领用数',
          key: 'recipients'
        },
        {
          title: '出币数',
          key: 'recipientsCOINS'
        },
        {
          title: '入币数',
          key: 'currencyNumber'
        },
        {
          title: '清币数',
          key: 'dynastyCOINS'
        },
        {
          title: '入库数',
          key: 'storageCOINS'
        },
        {
          title: '差异数量',
          key: 'quantityCOINS'
        }
      ],
      data2: []
    }
  },
  created () {
    this.data2 = this.row
  },
  methods: {
    setTable (params) {
      if (params.length) {
        params.forEach(element => {
          return h(expandRow, {
            props: {
              row: params.row.children
            }
          })
        })
      } else {
      }
    }
  }

}
</script>
<style lang="less">
td.ivu-table-expanded-cell {
  padding: 0;
}
</style>
